/*
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2024-08-25     Tian Yiqing  the first version
 */

#ifndef _FAL_CFG_H_
#define _FAL_CFG_H_

#include <rtconfig.h>
#include <board.h>

#define BOOT_PART_NAME "boot"
#define SYS_PART_NAME "sys"
#define SPIFLASH_PART_NAME "norflash"

/* ===================== Flash device Configuration ========================= */
extern const struct fal_flash_dev gd32f4_onchip_flash;
extern struct fal_flash_dev nor_flash0;

/* flash device table */
#define FAL_FLASH_DEV_TABLE                                          \
{                                                                    \
    &gd32f4_onchip_flash,                                           \
    &nor_flash0,                                                     \
}
/* ====================== Partition Configuration ========================== */
#ifdef FAL_PART_HAS_TABLE_CFG
/* partition table */
#define FAL_PART_TABLE                                                               \
{                                                                                    \
    {FAL_PART_MAGIC_WORD,     BOOT_PART_NAME,             "gd32_onchip",            0,   1024*1024, 0}, \
    {FAL_PART_MAGIC_WORD,      SYS_PART_NAME,             "gd32_onchip",    1024*1024,   1024*1024, 0}, \
    {FAL_PART_MAGIC_WORD, SPIFLASH_PART_NAME, FAL_USING_NOR_FLASH_DEV_NAME,         0, 2*1024*1024, 0}, \
}
#endif /* FAL_PART_HAS_TABLE_CFG */

#endif /* _FAL_CFG_H_ */
